<?php
include("db.inc");

$budget = $_POST['budget'];
$event = $_POST['event'];
$today = date("Y-m-d H-i-s"); 
$stylists = $_POST['stylists'];

mysql_query("INSERT INTO requests (budget, event, created_date, user_id) VALUES (".$budget.",'".$event."', '".$today."',".$_SESSION['User']['id'].")");
$req_id = mysql_insert_id();

$total_stylists = count($stylists);
for($i=0; $i < $total_stylists; $i++){
	mysql_query("INSERT INTO  requests_stylists (request_id, stylist_id) VALUES ('".$req_id."','".$stylists[$i]."')");
}

header('Location: index.php?page=confirmation.php');

?>